/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package race.util;

import race.component.RaceCanvas;

/**
 *
 * @author BBXP
 */
public class BackgroundUtil {
    public static final int TILE_WIDTH = 24;
    public static final int TILE_HEIGHT = 24;
    public static final int COLS = 11;//tile size 48
    public static final int ROWS = 200;
    public static final int TOTAL_WIDTH = TILE_WIDTH * COLS;
    public static final int TOTAL_HEIGHT = TILE_HEIGHT * ROWS;

    public static final int RODA_LEFT_LIMIT = TILE_WIDTH;
    public static final int ROAD_RIGHT_LIMIT = TOTAL_WIDTH - TILE_WIDTH;

    

    

    
    private static int[] roadMap = {
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 10, 10, 10, 10, 9, 10, 10, 10, 10, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5,
    };
    
    private static int[] shiftMap(int[] original){
        int[] temp = new int[original.length];
        for(int i = 0; i < original.length; i++){
            if(i - COLS*2 < 0){
                temp[i] = original[i];
            }else {
                temp[i] = original[i-COLS*2];
            }
        }
        return temp;
    }

    public static int[] getRoadMap(){
        return roadMap;
    }
    public static int[] getEasyCollisionMap(){
        return EasyCollisionUtil.getEasyCollisionMap();
    }
    public static int[] getEasyForeCollisionMap(){
        return shiftMap(EasyCollisionUtil.getEasyCollisionMap());
    }
    public static int[] getNormalCollisionMap(){
        return NormalCollisionUtil.getNormalCollisionMap();
    }
    public static int[] getNormalForeCollisionMap(){
        return shiftMap(NormalCollisionUtil.getNormalCollisionMap());
    }
    public static int[] getHardCollisionMap(){
        return HardCollisionUtil.getHardCollisionMap();
    }
    public static int[] getHardForeCollisionMap(){
        return shiftMap(HardCollisionUtil.getHardCollisionMap());
    }
    public static int[] getCollisionMap(int level){
        if(level == 1){
            return EasyCollisionUtil.getEasyCollisionMap();
        }else if(level == 2){
            return NormalCollisionUtil.getNormalCollisionMap();
        }else {
            return HardCollisionUtil.getHardCollisionMap();
        }
    }
    public static int[] getForeCollisionMap(int level){
        if(level == 1){
            return shiftMap(EasyCollisionUtil.getEasyCollisionMap());
        }else if (level == 2){
            return shiftMap(NormalCollisionUtil.getNormalCollisionMap());
        }else{
            return shiftMap(HardCollisionUtil.getHardCollisionMap());
        }
    }
}
